package io.kiki.sba.registry.store.jdbc.mapper;

import io.kiki.sba.registry.store.jdbc.domain.ClientManagerAddressDomain;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;


public interface ClientManagerAddressMapper {

    /**
     * query after than maxId
     *
     * @param dataCenter dataCenter
     * @param maxId      maxId
     * @param limit      limit
     * @return List
     */
    List<ClientManagerAddressDomain> queryAfterThanByLimit(@Param("dataCenter") String dataCenter, @Param("maxId") long maxId, @Param("limit") long limit);

    /**
     * @param clientManagerAddress clientManagerAddress
     * @return effect rows
     */
    int update(ClientManagerAddressDomain clientManagerAddress);

    /**
     * insert on replace
     *
     * @param clientManagerAddress clientManagerAddress
     * @return int
     */
    int insertOnReplace(ClientManagerAddressDomain clientManagerAddress);

    List<String> getExpireAddress(@Param("dataCenter") String dataCenter, @Param("expireDate") Date expireDate, @Param("limit") int limit);

    int cleanExpired(@Param("dataCenter") String dataCenter, @Param("expireAddress") List<String> expireAddress);

    int getClientOffSizeBefore(@Param("dataCenter") String dataCenter, @Param("expireDate") Date expireDate);
}
